package com.wkh.maker.cli.pattern;

/**
 * @author wkh
 * 客户端
 */
public class Client {
    public static void main(String[] args) {
        //创建接收者对象
        Device device123 = new Device("123");
        Device device456 = new Device("456");
        //创建具体命令对象，可以绑定不同设备
        TurnOnCommand turnOnCommand = new TurnOnCommand(device123);
        TurnOffCommand turnOffCommand = new TurnOffCommand(device456);
        //创建调用者
        RemoteControl remoteControl = new RemoteControl();
        //执行命令
        remoteControl.setCommand(turnOffCommand);
        remoteControl.pressButton();

        remoteControl.setCommand(turnOnCommand);
        remoteControl.pressButton();
    }
}
